package com.esiag.isidis.fi.service;

import java.io.IOException;
import java.net.DatagramPacket;
import java.net.DatagramSocket;
import java.net.Socket;
import java.net.SocketException;
import java.util.Observable;

public class UDPReceiver extends Observable implements IReceiver {

	public boolean startReceive() {

		DatagramPacket packet = new DatagramPacket(null, (Integer) null);
		DatagramSocket socket;
		try {
			socket = new DatagramSocket();
			while(true) {
				
				socket.receive( packet);
				setChanged();
				notifyObservers( packet);
			}
		} 
		
		catch (IOException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		return false;

	}

}
